package digg_api

import (
	"github.com/gin-gonic/gin"
	"giv-vue-blog/models"
	"giv-vue-blog/models/res"
	"giv-vue-blog/service/redis_ser"
)

// DiggArticleView 对文章进行点赞操作
// @Summary 对文章进行点赞操作
// @Tags 点赞管理
// @Accept json
// @Produce json
// @Param request body models.ESIDRequest true "文章ID"
// @Success 200 {string} json "{"code": 0, "message": "请求成功"}"
// @Failure 400 {string} json "{"code": 1, "message": "参数错误"}"
// @Failure 500 {string} json "{"code": 2, "message": "服务器内部错误"}"
// @Router /api/digg/article [post]
func (DiggApi) DiggArticleView(c *gin.Context) {
	var cr models.ESIDRequest
	err := c.ShouldBindJSON(&cr)
	if err != nil {
		res.FailedWithCode(res.ArgumentError, c)
		return
	}
	redis_ser.NewDigg().Set(cr.ID)
	res.FailedWithMsg("文章点赞成功", c)
}
